<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.view' );
class PropertiesViewShortlist extends JView
{	
	function display($tpl = null)
	{		
	$user =& JFactory::getUser();
	global $mainframe;
	
$component = JComponentHelper::getComponent( 'com_properties' );
$params = new JParameter( $component->params );

$Itemid =& $this->get('Itemid');

if(!$user->id){

$Itemid=JRequest::getVar('Itemid');
$Retornar='index.php?option=com_properties&view=shortlist&Itemid='.$Itemid;
$url = base64_encode($Retornar);
$link = 'index.php?option=com_properties&view=panel&task=login&return='.$url ;
	$msg = JText::_( 'Registered Users only can access' );	
		$mainframe->Redirect($link, $msg);		
}


$itemsShortList		=& $this->get( 'DataShortList');
$paginationShortList =& $this->get('PaginationShortList');
$this->assignRef('items',		$itemsShortList);
$this->assignRef('pagination', $paginationShortList);

/////fuck Jommfish////
//$NameProduct			=& $this->NameProduct();
$NameCategory			= $this->NameCategory();
$NameType				=& $this->NameType();
$NameCountry			= $this->NameCountry();
$NameState				=& $this->NameState();
$NameLocality			=& $this->NameLocality();

//$this->assignRef('NameProduct',		$NameProduct);
$this->assignRef('NameCategory',	$NameCategory);
$this->assignRef('NameType',		$NameType);
$this->assignRef('NameCountry',		$NameCountry);
$this->assignRef('NameState',		$NameState);
$this->assignRef('NameLocality',	$NameLocality);

///pls change/////

		parent::display($layout);
		
		
	}

function NameCategory()
	{	
	$db 	=& JFactory::getDBO();	
	$query = 'SELECT * FROM #__properties_category WHERE published = 1 ORDER BY id';		
        $db->setQuery($query);        
		$Categories = $db->loadObjectList();

	foreach ($Categories as $row) :
	$Category[$row->id] = $row->name;
	endforeach; 
	
	return $Category;
	}

function NameType()
	{	
	$db 	=& JFactory::getDBO();	
	$query = 'SELECT * FROM #__properties_type WHERE published = 1 ORDER BY name';		
        $db->setQuery($query);        
		$Types = $db->loadObjectList();
		
	foreach ($Types as $row) :
	$Type[$row->id] = $row->name;
	endforeach; 
	
			
		return $Type;
	}
	
function NameCountry()
	{	
	$db 	=& JFactory::getDBO();	
	$query = 'SELECT * FROM #__properties_country WHERE published = 1 ORDER BY name';		
        $db->setQuery($query);        
		$Countries = $db->loadObjectList();	
			
	foreach ($Countries as $row) :
	$Country[$row->id] = $row->name;
	endforeach; 
	
		return $Country;		
	}
function NameState()
	{	
	$db 	=& JFactory::getDBO();	
	$query = 'SELECT * FROM #__properties_state WHERE published = 1 ORDER BY name';		
        $db->setQuery($query);        
		$States = $db->loadObjectList();	
				
	foreach ($States as $row) :
	$State[$row->id] = $row->name;
	endforeach; 
	
		return $State;		
	}
function NameLocality()
	{	
	$db 	=& JFactory::getDBO();	
	$query = 'SELECT * FROM #__properties_locality WHERE published = 1 ORDER BY name';		
        $db->setQuery($query);        
		$Localities = $db->loadObjectList();	
				
	foreach ($Localities as $row) :
	$Locality[$row->id] = $row->name;
	endforeach; 
	
		return $Locality;		
	}
}